﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;



namespace WenXia
{
    class TimeOutSprite : AnimatedSprite
    {
        double timeout;
        DateTime showTime;
        GameTime gameTime;
        public TimeOutSprite(Game game, string asset)
            : base(game, asset)
        {
        }
        public void Show(double timeout)
        {
            this.timeout = timeout;
            this.Visible = true;
            showTime = DateTime.Now;
        }
        public override void Update(GameTime gameTime)
        {
            if (DateTime.Now.CompareTo(showTime.AddMilliseconds(timeout)) > 0)
                this.Visible = false;
            base.Update(gameTime);
        }
    }
}
